package ThreadPool.lagou.concurrent.demo02;

/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description:  synchronized
 * @date 2022/5/23 21:46
 */
public class GuanCheng {

    public final GuanCheng guanCheng1 = new GuanCheng();
    public final GuanCheng guanCheng2 = new GuanCheng();

    public synchronized  void method1(){}

    public static synchronized void method2(){}



    public void method3(){
        //锁对象
        synchronized (this){
        }
    }

    public static void method4(){
        synchronized (GuanCheng.class){

        }
    }

    private Object lock = new Object();
    public void method5(){
        //锁对象
        synchronized (lock){
        }
    }
}
